package com.qys.livesMall.financial.controller.app;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.financial.model.dto.app.AppFinancialOnlineUserPageDTO;
import com.qys.livesMall.financial.model.vo.app.AppFinancialOnlineUserPageVO;
import com.qys.livesMall.financial.service.FinancialOnlineUserService;
import com.qys.livesMall.framework.view.BaseQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户每日理财收益 前端控制器
 * </p>
 *
 * @author
 * @since 2023-06-13
 */
@RestController
@Tag(name = "APP-线上理财用户信息")
@RequestMapping("/app/financial/online/detail")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppFinancialOnlineUserController {

    private final FinancialOnlineUserService financialOnlineUserService;


    @PostMapping("/onlineUserPage")
    @Operation(summary = "分页查询用户持有产品")
    public R<Page<AppFinancialOnlineUserPageVO>> onlineUserPage(@RequestBody AppFinancialOnlineUserPageDTO pageDTO) {
        return R.ok(financialOnlineUserService.onlineUserPage(pageDTO));
    }


    @Operation(
            summary = "根据线上理财id查询理财详情",
            parameters = {
                    @Parameter(name = "financialId", description = "线上理财id")
            }
    )
    @GetMapping("/{financialId}")
    public R<AppFinancialOnlineUserPageVO> getByFinancialId(@PathVariable Long financialId) {
        return R.ok(financialOnlineUserService.getByFinancialId(financialId));
    }


}
